#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include <string>
#include <stack>

using namespace std;



int Calculator(string s, int& i);

int Calculator(string s)
{
	int i = 0;
	return Calculator(s, i);
}

int Calculator(string s,int& i)
{
	stack<int> st;
	char op = '+';
	while(i < s.size())
	{
		if (s[i] == ' ')
			i++;
		else if (s[i] == '+' || s[i] == '-' || s[i] == '*' || s[i] == '/')
		{
			op = s[i];
			i++;
		}
		else if (s[i] == '(')
		{
			i++;
			int tmp = Calculator(s, i);
			switch (op)
			{
			case '+':
				st.push(tmp);
				break;
			case '-':
				st.push(-tmp);
				break;
			case '*':
				st.top() *= tmp;
				break;
			case '/':
				st.top() /= tmp;
				break;
			}
		}
		else if (s[i] == ')')
		{
			i++;
			break;
		}
		else
		{
			int tmp = 0;
			for (; i < s.size() && s[i] >= '0' && s[i] <= '9'; i++)
				tmp = tmp * 10 + (s[i] - '0');
			switch (op)
			{
			case '+':
				st.push(tmp);
				break;
			case '-':
				st.push(-tmp);
				break;
			case '*':
				st.top() *= tmp;
				break;
			case '/':
				st.top() /= tmp;
				break;
			}
		}
	}
	int tmp = 0;
	while (!st.empty())
	{
		tmp += st.top(); st.pop();
	}
	return tmp;
}

int main()
{
	while (1)
	{
		cout << "Calculator: ";
		string s;
		while (!getline(cin, s))
		{
			;
		}
		int ret = Calculator(s);
		cout << ret << endl;
	}
}